Skip to content

FIX: PyInstallerでビルドされているときのルートディレクトリ取得方法を修正#1439

Merged
Hiroshiba merged 1 commit into
VOICEVOX:masterfrom
sabonerune:fix/engine_root
Jun 27, 2024
Merged

FIX: PyInstallerでビルドされているときのルートディレクトリ取得方法を修正#1439
Hiroshiba merged 1 commit into
VOICEVOX:masterfrom
sabonerune:fix/engine_root

Conversation

@sabonerune
Copy link
Copy Markdown
Contributor

内容

現在PyInstallerでビルドされているときにルートディレクトリをsys.argv[0]で取得しています。
しかしこの取得方法ではシンボリックリンクから起動した場合シンボリックリンクのファイルパスになってしまいます。
ref: https://pyinstaller.org/en/v5.13.1/runtime-information.html#using-sys-executable-and-sys-argv-0

この問題は #857 で修正しましたが後にrevertされています。 #1023

このPRでファイルパスの部分だけ再度修正します。

関連 Issue

その他

他にPath(__file__).parents[2]を使用して取得する方法がありますがこの方法だとPyinstaller v6に更新するとデフォルトでは_internalディレクトリを参照するようになります。
#857_internalに入れると判断したファイルと実行ファイルのディレクトリに入れるファイルの両方がevert後にresources入っていることからsys.executableの方にしました。

@sabonerune sabonerune requested a review from a team as a code owner June 26, 2024 13:59
@sabonerune sabonerune requested review from Hiroshiba and removed request for a team June 26, 2024 13:59
Copy link
Copy Markdown
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

なかなかに難しいですね。。

@Hiroshiba Hiroshiba merged commit 0fce2df into VOICEVOX:master Jun 27, 2024
@sabonerune sabonerune deleted the fix/engine_root branch June 27, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants